package lesson1_20.lesson15;


import lesson1_20.lesson14.Color2;

public class TestDemo {
    public static void main(String[] args) {
        System.out.println(Color2.RED);
        //枚举类的方法
        //ordinal()获取该值得序号
        System.out.println(Color2.RED.ordinal());

        //name()获取该值的名称
        System.out.println(Color2.RED.name());

        //values()，获取枚举的所有数据，返回的是一个数组
        for (Color2 color2 : Color2.values()) {
            int id = color2.ordinal();
            String name = color2.name();
            System.out.println(id + "====" + name);
        }

    }
}
